﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace PizzaService.View
{
    /// <summary>
    /// Interaction logic for ShowOrder.xaml
    /// </summary>
    public partial class ShowOrder : Window
    {
        private int m_Status;
        /// <summary>
        /// Bestellung anzeigen
        /// </summary>
        /// <param name="status"></param>
        public ShowOrder(int status)
        {
            InitializeComponent();
            m_Status = status;
            this.Loaded += ShowOrder_Loaded;
        }

        void ShowOrder_Loaded(object sender, RoutedEventArgs e)
        {
            DataContext = App.Controller.OpenedOrderViewModel;
            ComboState.SelectedIndex = m_Status;
        }
        /// <summary>
        /// Schließen Button Bestellung
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void BtnCloseShowOrder_Click_1(object sender, RoutedEventArgs e)
        {
            this.Close();
        }

        private void BtnCloseShowOrder_Click_2(object sender, RoutedEventArgs e)
        {
            if (ComboState.SelectedIndex != -1)
            {
                App.Controller.SaveOrderState(ComboState.SelectedIndex);
            }
            this.Close();
        }
    }
}
